package pdd;

import java.util.Scanner;

/**
 * @author zhangmin
 * @create 2022-03-20 16:48
 */
public class PDD2021_3{
    public static void main(String[] args){
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        int m=cin.nextInt();
        int[] left=new int[n+1];
        for(int i=1;i<=n;i++){
            left[i]=left[i-1]+cin.nextInt();
        }
        int count=0;
        for(int i=1;i<n;i++){
            for(int j=i;j<n;j++){
                int sum=left[j]-left[i-1];
                if(sum%m==0){
                    count++;
                }
            }
        }
        System.out.println(count);
    }

}
